#ifndef EXCEPTION_H
#define EXCEPTION_H

#define ENABLE_STACKTRACE if(DEBUG_BUILD) {ERR(JTT809Logger::logger(), JTT809Exception::stacktrace());}
#include <exception>
#include <string>

#include "jtt809_errcode.h"
namespace protocol {
	class JTT809Exception final : public std::exception {
		JTT809ErrorCode errCode;
		std::string message;
	public:
		JTT809Exception() = delete;
		explicit JTT809Exception(JTT809ErrorCode);
		JTT809Exception(JTT809ErrorCode, const std::string&);
		[[nodiscard]] const char* what() const noexcept override;
		static const std::string& stacktrace() noexcept;
	};
}

#endif // !EXCEPTION_H
